package com.example.zzm.yuejian03.Activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.example.zzm.yuejian03.Adapter.MasterAdapter;
import com.example.zzm.yuejian03.Bean.MasterBean;
import com.example.zzm.yuejian03.Listener.MasterListener;
import com.example.zzm.yuejian03.Model.MasterModel;
import com.example.zzm.yuejian03.R;

import java.util.List;

public class MasterActivity extends AppCompatActivity implements View.OnClickListener {

    private RecyclerView recyclerView;
    private TextView textView11;

    public void  onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_master);
        initViews();
        initEvent();
        // int club_id = getIntent().getIntExtra("club_id",1);
        MasterModel activModel = new MasterModel();
        activModel.getMasterList(listener);
//      ClassModel ClubModeldetails = new ClassModel();
//      ClubModeldetails.getClassList(getIntent().getIntExtra("club_id",1),listener);
    }

    MasterListener listener = new MasterListener() {
        @Override
        public void onResponse(List<MasterBean> beanlist) {
            MasterAdapter activAdapter = new MasterAdapter(getApplicationContext(),beanlist);
            recyclerView.setAdapter(activAdapter);
        }

        @Override
        public void onFail(String msg) {

        }
    };

    private void initEvent() {

        textView11.setOnClickListener(this);
    }

    private void initViews() {
        textView11 = (TextView)findViewById(R.id.textView11);
        recyclerView = (RecyclerView)findViewById(R.id.recyclerview);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this.getApplicationContext());
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(layoutManager);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.textView11:
                finish();
                break;
        }
    }
}
